package io;

import player.Player;
import protomsg.Result.ErrorMsg2;
import protomsg.Result.ServerResFlag;
import protomsg.Rpc.ServerID;
import util.CommonTool;

public class ErrorHandler {
	public static final void sendErrorMessage(ClientSession session,
			int serial, int type, String message) {
		if (session != null) {
//			Packet pt = new Packet(OpCode.ERROR);
//			pt.putInt(serial);
//			pt.putShort(type);
//			pt.putString(message);
//			session.send(pt);
		}
	}
	
	public static final void sendError(ClientSession session,ServerResFlag flag)
	{
		ErrorMsg2.Builder build = ErrorMsg2.newBuilder();
		
		build.setFlag(flag);
		
		CommonTool.SendMsg(build, session, ServerID.Error_VALUE);
	}
	
	public static final void sendError(Player player,ServerResFlag flag)
	{
		ClientSession session = player.session;
		ErrorMsg2.Builder build = ErrorMsg2.newBuilder();
		
		build.setFlag(flag);
		
		CommonTool.SendMsg(build, session, ServerID.Error_VALUE);
	}
	
	/*public static final void sendAdminErrorMessage(ClientSession session,int serial,int type,String message){
		if(session != null){
			Packet pt = new Packet(OpCode.ADMIN_ERROR);
			pt.putInt(serial);
			pt.putShort(type);
			pt.putString(message);
			session.send(pt);
		}
	}*/
	
}
